public class Solution1 {
    public boolean evaluateTree(TreeNode root) {
        if(root.left == null) {
            if(root.val == 0) {
                return false;
            }else {
                return true;
            }
        }
        boolean leftTree = evaluateTree(root.left);
        boolean rightTree = evaluateTree(root.right);
        if(root.val == 2) {
            return leftTree | rightTree;
        }else {
            return leftTree & rightTree;
        }

    }
}